package top.oauth2.api.demo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import top.oauth2.api.demo.service.TestPolymorphismService;
import top.oauth2.common.response.ResponseMessage;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author xphu
 * @version 1.0
 * @date 2021/9/2 11:04
 */
@RestController
public class TestController {

    @Resource(name = "getPolymorphismService")
    TestPolymorphismService testPolymorphismService;


    /**
     * todo 多态+ApplicationContext+ApplicationContextAware 测试
     * @param type
     * @return
     */
    @GetMapping("/getName")
    public Map<String, Object> demo1(Integer type) {
        return ResponseMessage.builder().success(testPolymorphismService.getName(type)).message();
    }
}
